/*
 * Settings.java
 *
 * Created on Dec 15, 2008, 7:06:11 PM
 */
package neobux;

import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.DropDown;
import com.sun.webui.jsf.component.StaticText;
import com.sun.webui.jsf.component.TextField;
import com.sun.webui.jsf.model.SingleSelectOptionsList;
import java.sql.*;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;

/**
 * <p>Page bean that corresponds to a similarly named JSP page.  This
 * class contains component definitions (and initialization code) for
 * all components that you have defined on this page, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.</p>
 *
 * @author Onur Erdinc
 */
public class Settings extends AbstractPageBean {
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">

    /**
     * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {
        countryDropDownDefaultOptions.setOptions(new com.sun.webui.jsf.model.Option[]{new com.sun.webui.jsf.model.Option("", "Select Country"), new com.sun.webui.jsf.model.Option("Afghanistan", "Afghanistan"), new com.sun.webui.jsf.model.Option("Albania", "Albania"), new com.sun.webui.jsf.model.Option("Algeria", "Algeria"), new com.sun.webui.jsf.model.Option("American Samoa", "American Samoa"), new com.sun.webui.jsf.model.Option("Andorra", "Andorra"), new com.sun.webui.jsf.model.Option("Angola", "Angola"),new com.sun.webui.jsf.model.Option("Anguilla", "Anguilla"), new com.sun.webui.jsf.model.Option("Antarctica", "Antarctica"), new com.sun.webui.jsf.model.Option("Antigua And Barbuda", "Antigua And Barbuda"), new com.sun.webui.jsf.model.Option("Argentina", "Argentina"), new com.sun.webui.jsf.model.Option("Armenia", "Armenia"), new com.sun.webui.jsf.model.Option("Aruba", "Aruba"), new com.sun.webui.jsf.model.Option("Australia", "Australia"), new com.sun.webui.jsf.model.Option("Austria", "Austria"), new com.sun.webui.jsf.model.Option("Azerbaijan", "Azerbaijan"), new com.sun.webui.jsf.model.Option("Bahamas", "Bahamas"), new com.sun.webui.jsf.model.Option("Bahrain", "Bahrain"), new com.sun.webui.jsf.model.Option("Bangladesh", "Bangladesh"), new com.sun.webui.jsf.model.Option("Barbados", "Barbados"), new com.sun.webui.jsf.model.Option("Belarus ", "Belarus "), new com.sun.webui.jsf.model.Option("Belgium ", "Belgium "), new com.sun.webui.jsf.model.Option("Belize ", "Belize "), new com.sun.webui.jsf.model.Option("Benin", "Benin"), new com.sun.webui.jsf.model.Option("Bermuda", "Bermuda"), new com.sun.webui.jsf.model.Option("Bhutan", "Bhutan"), new com.sun.webui.jsf.model.Option("Bolivia", "Bolivia"), new com.sun.webui.jsf.model.Option("Bosnia and Herzegovina", "Bosnia and Herzegovina"), new com.sun.webui.jsf.model.Option("Botswana", "Botswana"), new com.sun.webui.jsf.model.Option("Bouvet Island", "Bouvet Island"), new com.sun.webui.jsf.model.Option("Brazil", "Brazil"), new com.sun.webui.jsf.model.Option("British Indian Ocean Territory", "British Indian Ocean Territory"), new com.sun.webui.jsf.model.Option("Brunei", "Brunei"), new com.sun.webui.jsf.model.Option("Bulgaria", "Bulgaria"), new com.sun.webui.jsf.model.Option("Burkina Faso", "Burkina Faso"), new com.sun.webui.jsf.model.Option("Burma", "Burma"), new com.sun.webui.jsf.model.Option("Burundi", "Burundi"), new com.sun.webui.jsf.model.Option("Cambodia", "Cambodia"), new com.sun.webui.jsf.model.Option("Cameroon", "Cameroon"), new com.sun.webui.jsf.model.Option("Canada", "Canada"), new com.sun.webui.jsf.model.Option("Cape Verde", "Cape Verde"), new com.sun.webui.jsf.model.Option("Cayman Islands", "Cayman Islands"), new com.sun.webui.jsf.model.Option("Central African Republic", "Central African Republic"), new com.sun.webui.jsf.model.Option("Chad", "Chad"), new com.sun.webui.jsf.model.Option("Chile", "Chile"), new com.sun.webui.jsf.model.Option("China", "China"), new com.sun.webui.jsf.model.Option("Colombia", "Colombia"), new com.sun.webui.jsf.model.Option("Comoros", "Comoros"), new com.sun.webui.jsf.model.Option("Congo", "Congo"), new com.sun.webui.jsf.model.Option("Costa Rica ", "Costa Rica "), new com.sun.webui.jsf.model.Option("Croatia", "Croatia"), new com.sun.webui.jsf.model.Option("Cuba ", "Cuba "), new com.sun.webui.jsf.model.Option("Cyprus", "Cyprus"), new com.sun.webui.jsf.model.Option("Czech Republic", "Czech Republic"), new com.sun.webui.jsf.model.Option("Denmark", "Denmark"), new com.sun.webui.jsf.model.Option("Djibouti", "Djibouti"), new com.sun.webui.jsf.model.Option("Dominica", "Dominica"), new com.sun.webui.jsf.model.Option("Dominican Republic", "Dominican Republic"), new com.sun.webui.jsf.model.Option("East Timor", "East Timor"), new com.sun.webui.jsf.model.Option("Ecuador", "Ecuador"), new com.sun.webui.jsf.model.Option("Egypt", "Egypt"), new com.sun.webui.jsf.model.Option("El Salvador", "El Salvador"), new com.sun.webui.jsf.model.Option("Equatorial Guinea", "Equatorial Guinea"), new com.sun.webui.jsf.model.Option("Eritrea", "Eritrea"), new com.sun.webui.jsf.model.Option("Estonia", "Estonia"), new com.sun.webui.jsf.model.Option("Ethiopia ", "Ethiopia "), new com.sun.webui.jsf.model.Option("Fiji", "Fiji"), new com.sun.webui.jsf.model.Option("Finland ", "Finland "), new com.sun.webui.jsf.model.Option("France ", "France "), new com.sun.webui.jsf.model.Option("Gabon ", "Gabon "), new com.sun.webui.jsf.model.Option("Gambia ", "Gambia "), new com.sun.webui.jsf.model.Option("Georgia ", "Georgia "), new com.sun.webui.jsf.model.Option("Germany ", "Germany "), new com.sun.webui.jsf.model.Option("Ghana ", "Ghana "), new com.sun.webui.jsf.model.Option("Greece ", "Greece "), new com.sun.webui.jsf.model.Option("Grenada ", "Grenada "), new com.sun.webui.jsf.model.Option("Guatemala ", "Guatemala "), new com.sun.webui.jsf.model.Option("Guinea ", "Guinea "), new com.sun.webui.jsf.model.Option("Guinea-Bissau ", "Guinea-Bissau "), new com.sun.webui.jsf.model.Option("Guyana", "Guyana"), new com.sun.webui.jsf.model.Option("Haiti", "Haiti"), new com.sun.webui.jsf.model.Option("Honduras", "Honduras"), new com.sun.webui.jsf.model.Option("Hungary ", "Hungary "), new com.sun.webui.jsf.model.Option("Iceland ", "Iceland "), new com.sun.webui.jsf.model.Option("India ", "India "), new com.sun.webui.jsf.model.Option("Indonesia", "Indonesia"), new com.sun.webui.jsf.model.Option("Iran ", "Iran "), new com.sun.webui.jsf.model.Option("Iraq ", "Iraq "), new com.sun.webui.jsf.model.Option("Ireland", "Ireland"), new com.sun.webui.jsf.model.Option("Israel ", "Israel "), new com.sun.webui.jsf.model.Option("Italy ", "Italy "), new com.sun.webui.jsf.model.Option("Ivory Coast ", "Ivory Coast "), new com.sun.webui.jsf.model.Option("Jamaica", "Jamaica"), new com.sun.webui.jsf.model.Option("Japan", "Japan"), new com.sun.webui.jsf.model.Option("Jordan ", "Jordan "), new com.sun.webui.jsf.model.Option("Kazakhstan ", "Kazakhstan "), new com.sun.webui.jsf.model.Option("Kenya ", "Kenya "), new com.sun.webui.jsf.model.Option("Kiribati ", "Kiribati "), new com.sun.webui.jsf.model.Option("Korea North ", "Korea North "), new com.sun.webui.jsf.model.Option("Korea South ", "Korea South "), new com.sun.webui.jsf.model.Option("Kosovo ", "Kosovo "), new com.sun.webui.jsf.model.Option("Kuwait ", "Kuwait "), new com.sun.webui.jsf.model.Option("Kyrgyzstan ", "Kyrgyzstan "), new com.sun.webui.jsf.model.Option("Laos", "Laos"), new com.sun.webui.jsf.model.Option("Latvia", "Latvia"), new com.sun.webui.jsf.model.Option("Lebanon ", "Lebanon "), new com.sun.webui.jsf.model.Option("Lesotho ", "Lesotho "), new com.sun.webui.jsf.model.Option("Liberia ", "Liberia "), new com.sun.webui.jsf.model.Option("Libya ", "Libya "), new com.sun.webui.jsf.model.Option("Liechtenstein ", "Liechtenstein "), new com.sun.webui.jsf.model.Option("Lithuania ", "Lithuania "), new com.sun.webui.jsf.model.Option("Luxembourg ", "Luxembourg "), new com.sun.webui.jsf.model.Option("Macedonia ", "Macedonia "), new com.sun.webui.jsf.model.Option("Madagascar", "Madagascar "), new com.sun.webui.jsf.model.Option("Malawi ", "Malawi "), new com.sun.webui.jsf.model.Option("Malaysia ", "Malaysia "), new com.sun.webui.jsf.model.Option("Maldives ", "Maldives "), new com.sun.webui.jsf.model.Option("Mali ", "Mali "), new com.sun.webui.jsf.model.Option("Malta ", "Malta "), new com.sun.webui.jsf.model.Option("Marshall Islands ", "Marshall Islands "), new com.sun.webui.jsf.model.Option("Mauritania ", "Mauritania "), new com.sun.webui.jsf.model.Option("Mauritius ", "Mauritius "), new com.sun.webui.jsf.model.Option("Mexico ", "Mexico "), new com.sun.webui.jsf.model.Option("Micronesia ", "Micronesia "), new com.sun.webui.jsf.model.Option("Moldova ", "Moldova "), new com.sun.webui.jsf.model.Option("Monaco ", "Monaco "), new com.sun.webui.jsf.model.Option("Mongolia ", "Mongolia "), new com.sun.webui.jsf.model.Option("Montenegro ", "Montenegro "), new com.sun.webui.jsf.model.Option("Morocco ", "Morocco "), new com.sun.webui.jsf.model.Option("Mozambique ", "Mozambique "), new com.sun.webui.jsf.model.Option("value", "Myanmar"), new com.sun.webui.jsf.model.Option("Myanmar", "Namibia "), new com.sun.webui.jsf.model.Option("Nauru ", "Nauru "), new com.sun.webui.jsf.model.Option("Nepal ", "Nepal "), new com.sun.webui.jsf.model.Option("Netherlands ", "Netherlands "), new com.sun.webui.jsf.model.Option("New Zealand ", "New Zealand "), new com.sun.webui.jsf.model.Option("Nicaragua ", "Nicaragua "), new com.sun.webui.jsf.model.Option("Niger ", "Niger "), new com.sun.webui.jsf.model.Option("Nigeria ", "Nigeria "), new com.sun.webui.jsf.model.Option("Norway ", "Norway "), new com.sun.webui.jsf.model.Option("Oman ", "Oman "), new com.sun.webui.jsf.model.Option("Pakistan ", "Pakistan "), new com.sun.webui.jsf.model.Option("Palau ", "Palau "), new com.sun.webui.jsf.model.Option("Panama ", "Panama "), new com.sun.webui.jsf.model.Option("Papua New Guinea ", "Papua New Guinea "), new com.sun.webui.jsf.model.Option("Paraguay ", "Paraguay "), new com.sun.webui.jsf.model.Option("Peru ", "Peru "), new com.sun.webui.jsf.model.Option("Philippines ", "Philippines "), new com.sun.webui.jsf.model.Option("Poland ", "Poland "), new com.sun.webui.jsf.model.Option("Portugal ", "Portugal "), new com.sun.webui.jsf.model.Option("Qatar ", "Qatar "), new com.sun.webui.jsf.model.Option("Romania ", "Romania "), new com.sun.webui.jsf.model.Option("Russian Federation", "Russian Federation"), new com.sun.webui.jsf.model.Option("Rwanda ", "Rwanda "), new com.sun.webui.jsf.model.Option("St Kitts & Nevis", "St Kitts & Nevis"), new com.sun.webui.jsf.model.Option("St Lucia", "St Lucia"), new com.sun.webui.jsf.model.Option("Saint Vincent & the Grenadines", "Saint Vincent & the Grenadines"), new com.sun.webui.jsf.model.Option("Samoa ", "Samoa "), new com.sun.webui.jsf.model.Option("San Marino", "San Marino"), new com.sun.webui.jsf.model.Option("Sao Tome & Principe", "Sao Tome & Principe"),new com.sun.webui.jsf.model.Option("Saudi Arabia", "Saudi Arabia"), new com.sun.webui.jsf.model.Option("Senegal ", "Senegal "), new com.sun.webui.jsf.model.Option("Serbia ", "Serbia "), new com.sun.webui.jsf.model.Option("Seychelles ", "Seychelles "), new com.sun.webui.jsf.model.Option("Sierra Leone", "Sierra Leone"), new com.sun.webui.jsf.model.Option("Singapore ", "Singapore "), new com.sun.webui.jsf.model.Option("Slovakia ", "Slovakia "), new com.sun.webui.jsf.model.Option("Slovenia ", "Slovenia "), new com.sun.webui.jsf.model.Option("Solomon Islands", "Solomon Islands"), new com.sun.webui.jsf.model.Option("Somalia ", "Somalia "), new com.sun.webui.jsf.model.Option("South Africa", "South Africa"), new com.sun.webui.jsf.model.Option("Spain ", "Spain "), new com.sun.webui.jsf.model.Option("Sri Lanka", "Sri Lanka"), new com.sun.webui.jsf.model.Option("Sudan ", "Sudan "), new com.sun.webui.jsf.model.Option("Suriname ", "Suriname "), new com.sun.webui.jsf.model.Option("Swaziland ", "Swaziland "), new com.sun.webui.jsf.model.Option("Sweden ", "Sweden "), new com.sun.webui.jsf.model.Option("Switzerland ", "Switzerland "),new com.sun.webui.jsf.model.Option("Syria ", "Syria "), new com.sun.webui.jsf.model.Option("Taiwan ", "Taiwan "), new com.sun.webui.jsf.model.Option("Tajikistan ", "Tajikistan "), new com.sun.webui.jsf.model.Option("Tanzania ", "Tanzania "), new com.sun.webui.jsf.model.Option("Thailand ", "Thailand "), new com.sun.webui.jsf.model.Option("Togo ", "Togo "), new com.sun.webui.jsf.model.Option("Tonga ", "Tonga "), new com.sun.webui.jsf.model.Option("Trinidad & Tobago", "Trinidad & Tobago"), new com.sun.webui.jsf.model.Option("Tunisia ", "Tunisia "), new com.sun.webui.jsf.model.Option("Turkey ", "Turkey "), new com.sun.webui.jsf.model.Option("Turkmenistan ", "Turkmenistan "), new com.sun.webui.jsf.model.Option("Tuvalu ", "Tuvalu "), new com.sun.webui.jsf.model.Option("Uganda ", "Uganda "), new com.sun.webui.jsf.model.Option("Ukraine ", "Ukraine "), new com.sun.webui.jsf.model.Option("United Arab Emirates", "United Arab Emirates"), new com.sun.webui.jsf.model.Option("United Kingdom", "United Kingdom"), new com.sun.webui.jsf.model.Option("United States", "United States"), new com.sun.webui.jsf.model.Option("Uruguay ", "Uruguay "), new com.sun.webui.jsf.model.Option("Uzbekistan ", "Uzbekistan "), new com.sun.webui.jsf.model.Option("Vanuatu ", "Vanuatu "), new com.sun.webui.jsf.model.Option("Vatican City", "Vatican City"), new com.sun.webui.jsf.model.Option("Venezuela", "Venezuela"), new com.sun.webui.jsf.model.Option("Vietnam ", "Vietnam "), new com.sun.webui.jsf.model.Option("Yemen ", "Yemen "), new com.sun.webui.jsf.model.Option("Zambia ", "Zambia "),new com.sun.webui.jsf.model.Option("Zimbabwe ", "Zimbabwe ")});
    }

    // </editor-fold>
    private int id;
    private String username;
    private String password;
    private String passConf;
    private String eMail;
    private String country;
    

   
    private StaticText staticText1 = new StaticText();

    public StaticText getStaticText1() {
        return staticText1;
    }

    public void setStaticText1(StaticText st) {
        this.staticText1 = st;
    }
    private StaticText staticText2 = new StaticText();

    public StaticText getStaticText2() {
        return staticText2;
    }

    public void setStaticText2(StaticText st) {
        this.staticText2 = st;
    }
    private StaticText staticText3 = new StaticText();

    public StaticText getStaticText3() {
        return staticText3;
    }

    public void setStaticText3(StaticText st) {
        this.staticText3 = st;
    }

    private SingleSelectOptionsList countryDropDownDefaultOptions = new SingleSelectOptionsList();

    public SingleSelectOptionsList getCountryDropDownDefaultOptions() {
        return countryDropDownDefaultOptions;
    }

    public void setCountryDropDownDefaultOptions(SingleSelectOptionsList ssol) {
        this.countryDropDownDefaultOptions = ssol;
    }
    private DropDown countryDropDown = new DropDown();

    public DropDown getCountryDropDown() {
        return countryDropDown;
    }

    public void setCountryDropDown(DropDown dd) {
        this.countryDropDown = dd;
    }
    private TextField textField3 = new TextField();

    public TextField getTextField3() {
        return textField3;
    }

    public void setTextField3(TextField tf) {
        this.textField3 = tf;
    }

    /**
     * <p>Construct a new Page bean instance.</p>
     */
    public Settings() {
    }

    /**
     * <p>Callback method that is called whenever a page is navigated to,
     * either directly via a URL, or indirectly via page navigation.
     * Customize this method to acquire resources that will be needed
     * for event handlers and lifecycle methods, whether or not this
     * page is performing post back processing.</p>
     * 
     * <p>Note that, if the current request is a postback, the property
     * values of the components do <strong>not</strong> represent any
     * values submitted with this request.  Instead, they represent the
     * property values that were saved for this view when it was rendered.</p>
     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here

        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("Settings Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
        }

    // </editor-fold>
    // Perform application initialization that must complete
    // *after* managed components are initialized
    // TODO - add your own initialization code here
    }

    /**
     * <p>Callback method that is called after the component tree has been
     * restored, but before any event processing takes place.  This method
     * will <strong>only</strong> be called on a postback request that
     * is processing a form submit.  Customize this method to allocate
     * resources that will be required in your event handlers.</p>
     */
    @Override
    public void preprocess() {
 
    }

    /**
     * <p>Callback method that is called just before rendering takes place.
     * This method will <strong>only</strong> be called for the page that
     * will actually be rendered (and not, for example, on a page that
     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.</p>
     */
    @Override
    public void prerender() {
        id=getSessionBean1().getId();
        username=getSessionBean1().getUsername();
         if(username.equals(""))
             try{
             FacesContext.getCurrentInstance().getExternalContext().dispatch("Login.jsp");
             }catch(Exception e)
             {
                e.printStackTrace();
             }
          
        try{
            
            Class.forName("org.apache.derby.jdbc.ClientDriver");
            Connection conn=DriverManager.getConnection("jdbc:derby://localhost:1527/itubux","itubux","itubux");
            Statement smt=conn.createStatement();
            String query="SELECT * FROM KULLANICI WHERE KADI='"+username+"'";
            ResultSet result=smt.executeQuery(query);
                textField3.setText(result.getString("EPOSTA"));
                countryDropDown.setSelected(result.getString("ULKE"));
                conn.close();
         }
        catch(ClassNotFoundException e){
               e.printStackTrace();
        }
        catch(SQLException e){
               e.printStackTrace();
        }
        staticText1.setText("Hosgeldiniz "+username+ " - User id: " +id);
    }

    /**
     * <p>Callback method that is called after rendering is completed for
     * this request, if <code>init()</code> was called (regardless of whether
     * or not this was the page that was actually rendered).  Customize this
     * method to release resources acquired in the <code>init()</code>,
     * <code>preprocess()</code>, or <code>prerender()</code> methods (or
     * acquired during execution of an event handler).</p>
     */
    @Override
    public void destroy() {
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected SessionBean1 getSessionBean1() {
        return (SessionBean1) getBean("SessionBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected RequestBean1 getRequestBean1() {
        return (RequestBean1) getBean("RequestBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1) getBean("ApplicationBean1");
    }

    public void countryDrop_processValueChange(ValueChangeEvent event) {
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPassConf() {
        return passConf;
    }

    public void setPassConf(String passConf) {
        this.passConf = passConf;
    }

    public String getEMail() {
        return eMail;
    }

    public void setEMail(String eMail) {
        this.eMail = eMail;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String button1_action() throws SQLException {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
       
        if (password.isEmpty() && !passConf.isEmpty()) {
            staticText2.setText("Please fill the password field first!");
        }
        if (!password.isEmpty() && passConf.isEmpty()) {
            staticText2.setText("Please rewrite the new password");
        }
        if (!(countryDropDown.getSelected().toString().equals(""))) {
            country=countryDropDown.getSelected().toString();
        }

        /*
        if (password.equals(passConf) || !(eMail.equals("")) || !(country.equals("empty"))) {
            staticText3.setText("Your changes have been saved!");
        }*/
       try {

            Class.forName("org.apache.derby.jdbc.ClientDriver");
            Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/itubux", "itubux", "itubux");

            String query= "UPDATE KULLANICI SET ";
            Statement smt =  conn.createStatement();
           
            if((!password.trim().isEmpty() && passConf.trim().equals(password)) || !country.isEmpty() || !eMail.isEmpty())
            {
             query += (!password.trim().isEmpty() && passConf.trim().equals(password)) ? "PAROLA='" + password + "'," : "";
             query += !country.isEmpty() ? "ULKE='" + country + "'," : "";
             query += !eMail.isEmpty() ? "EPOSTA='" + eMail + "'" : "";
             if(query.endsWith(","))
                 query = query.substring(0, query.length()-1);
             query += " WHERE KADI='" +username+"'";
             //staticText2.setText(query);

            int result = smt.executeUpdate(query);
            if (result==1){
                staticText3.setText("Your changes have been saved!");
               }
            }
            else
                staticText3.setText("Please fill at least one field");
                    
         conn.close();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return "failure";
        } catch (SQLException e) {
            e.printStackTrace();
            return "failure";
        }

        return "success";
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String hyperlink1_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return "View";
    }

    public String hyperlink2_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return null;
    }

    public String hyperlink3_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return null;
    }

    public String hyperlink4_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return null;
    }

    public String hyperlink5_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return "Settings";
    }

    public String hyperlink6_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return "AdSettings";
    }

    public String hyperlink7_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return null;
    }

    public String hyperlink8_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return null;
    }

    public String hyperlink9_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return null;
    }

    public String hyperlink10_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        return null;
    }

}

